from tkinter import *
#import random

root = Tk()

text = Text(root)
text.pack()
entry = Entry(root)
entry.pack()
def greet():
    #print('hello world')
     text.insert(CURRENT,'hello world\n')#插入到文本框
def read():
        s = entry.get()
        text.insert(CURRENT,s)
def clear():
    text.delete('0.0','end')

button_greet = Button(root,text="Greet",command=greet)
button_greet.pack()

button_read = Button(root,text="Read",command=read)
button_read.pack()

button_clear= Button(root,text="Clear",command=clear)
button_clear.pack()
root.mainloop()